home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ifp1s155.zip / IFPINIT.PAS < prev    next >
Pascal/Delphi Source File  |  1992-04-21  |  5KB  |  224 lines

  1. unit ifpinit;
  2.  
  3. interface
  4.  
  5. uses crt, graph, dos, ifpglobl, ifpcomon, IFPScrPt;
  6.  
  7. procedure init;
  8.  
  9. implementation
  10.  
  11. procedure init;
  12.   var
  13.     xint: integer;
  14.  
  15.   procedure rjustify(a : string);
  16.     begin
  17.     GotoXY(1 + lo(WindMax) - length(a), wherey);
  18.     x2:=WhereX;
  19.     Write(a)
  20.     end; {rjustify}
  21.  
  22.   procedure border(ch: char);
  23.     var
  24.       i : byte;
  25.  
  26.     begin
  27.     TextColor(LightCyan);
  28.     for i:=1 to twidth do
  29.       Write(ch);
  30.     TextColor(LightGray);
  31.     end; {border}
  32.  
  33.   procedure checkparams;
  34.     var
  35.       s: string;
  36.       parm: word;
  37.  
  38.     function deletejunk(s: string): string;
  39.       var
  40.         x: byte;
  41.  
  42.       begin
  43.       while (Length(s) > 0) and ((s[1] = ' ') or (s[1] = '-') or (s[1] = '/')) do
  44.         s:=Copy(s, 2, 255);
  45.       while (Length(s) > 0) and (s[Length(s)] = ' ') do
  46.         Dec(s[0]);
  47.       if Length(s) > 0 then
  48.         for x:=1 to Length(s) do
  49.           s[x]:=UpCase(s[x]);
  50.       deletejunk:=s;
  51.       end;
  52.  
  53.     begin {checkparams}
  54.     for parm:=1 to ParamCount do
  55.       begin
  56.       s:=deletejunk(ParamStr(parm));
  57.       if s = 'B' then
  58.         DirectVideo:=false;
  59.       if s = 'D' then
  60.         DirectVideo:=true;
  61.       if s = 'M' then
  62.         mono:=true;
  63.       if s = 'C' then
  64.         mono:=false;
  65.       if s = 'NV' then
  66.         novgacheck:=true;
  67.       if s = 'AP' then
  68.         PrinterRec.Mode:='A';
  69.       if (s = '?') or (s = 'H') then
  70.         begin
  71.         Assign(output, '');
  72.         ReWrite(output);
  73.         Assign(input, '');
  74.         Reset(input);
  75.         Writeln('INFOPLUS ', qversion, '  Compiled: ', qdate);
  76.         Writeln;
  77.         Writeln('Syntax:');
  78.         Writeln('  INFOPLUS [B][D][M][C][NV][AP][H][?]');
  79.         Writeln('where:');
  80.         Writeln('  B  = Write to screen using BIOS (default under Desqview)');
  81.         Writeln('  D  = Write directly to screen memory (default)');
  82.         Writeln('  M  = Use monochrome colors (default under MODE BWxx)');
  83.         Writeln('  C  = Use normal colors (default)');
  84.         Writeln('  NV = Do not perform VGA chipset detection');
  85.         Writeln('  AP = AutoPrint all screens');
  86.         Writeln('  H or ? = This help screen');
  87.         Writeln;
  88.         Writeln('ex: INFOPLUS B M NV');
  89.         Writeln('      Run infoplus using BIOS, monochrome colors, no VGA check.');
  90.         Writeln;
  91.         Halt
  92.         end;
  93.       end;
  94.     end;
  95.  
  96.   begin {init}
  97.   mono:=false;
  98.   vidmode:=LastMode;
  99.   attrsave:=TextAttr;
  100.   CheckBreak:=False;
  101.   resetvideo:=false;
  102.   novgacheck:=false;
  103.   if (Lo(LastMode) = 0) or (Lo(LastMode) = 1) then
  104.     begin
  105.     TextMode(LastMode + 2);
  106.     resetvideo:=true
  107.     end;
  108.   with regs do
  109.     begin
  110.     AH:=$0F;
  111.     intr($10, regs);
  112.     twidth:=AH;
  113.     vidpg:=BH
  114.     end;
  115.   detectgraph(graphdriver, xint);
  116.   if (graphdriver = EGA) or (graphdriver = MCGA) or (graphdriver = VGA) then
  117.     with regs do
  118.       begin
  119.       AX:=$1130;
  120.       BH:=$00;
  121.       intr($10, regs);
  122.       tlength:=DL + 1;
  123.       CheckSnow:=False;
  124.       end
  125.   else
  126.     tlength:=25;
  127.   with regs do
  128.     begin
  129.     intr($11, regs);
  130.     equip:=AX;
  131.     intr($12, regs);
  132.     DOSmem:=longint(AX) shl 10;
  133.     AH:=$19;
  134.     MSDOS(regs);
  135.     currdrv:=AL;
  136.     AH:=$34;
  137.     MSDOS(regs);
  138.     DOScseg:=ES;
  139.     DOScofs:=BX
  140.     end;
  141.   SwapVectors;
  142.   for i:=$00 to $FF do
  143.     getintvec(i, intvec[i]);
  144.   SwapVectors;
  145. {
  146.   intvec[$00]:=saveint00;
  147.   intvec[$02]:=saveint02;
  148.   intvec[$1B]:=saveint1B;
  149.   intvec[$23]:=saveint23;
  150.   intvec[$24]:=saveint24;
  151.   intvec[$34]:=saveint34;
  152.   intvec[$35]:=saveint35;
  153.   intvec[$36]:=saveint36;
  154.   intvec[$37]:=saveint37;
  155.   intvec[$38]:=saveint38;
  156.   intvec[$39]:=saveint39;
  157.   intvec[$3A]:=saveint3A;
  158.   intvec[$3B]:=saveint3B;
  159.   intvec[$3C]:=saveint3C;
  160.   intvec[$3D]:=saveint3D;
  161.   intvec[$3E]:=saveint3E;
  162.   intvec[$3F]:=saveint3F;
  163.   intvec[$75]:=saveint75;
  164. }
  165.   with regs do
  166.     begin
  167.     AX:=$3700;
  168.     MSDOS(regs);
  169.     switchar:=chr(DL)
  170.     end;
  171.   dirsep:=['\'];
  172.   if switchar <> '/' then
  173.     dirsep:=dirsep + ['/'];
  174.   with regs do
  175.     begin
  176.     AH:=$52;
  177.     MSDOS(regs);
  178.     devseg:=ES;
  179.     devofs:=BX
  180.     end;
  181.   lastdrv:=Mem[devseg:devofs + $0021];
  182.   if (Lo(LastMode) = 2) or (Lo(LastMode) = 7) then
  183.     mono:=true;
  184.   with regs do
  185.     begin
  186.     AX:=$2B01;
  187.     CX:=$4445; {DE}
  188.     DX:=$5351; {SQ}
  189.     MsDos(regs);
  190.     if AL <> $FF then
  191.       DirectVideo:=False;
  192.     end;
  193.   if ParamCount > 0 then
  194.     checkparams;
  195.   Textcolor(LightGreen);
  196.   TextBackground(Blue);
  197.   Clrscr;
  198.   Write('INFO+');
  199.   Textcolor(lightgray);
  200.   Write(' - Information on all computer functions');
  201.   rjustify(qversion);
  202.   Writeln;
  203.   border(#223);
  204.   GotoXY(1, tlength - 1);
  205.   border(#220);
  206.   Write('Page ');
  207.   x1:=wherex;
  208.   Textcolor(Lightgreen);
  209.   rjustify('F1 Enter PgUp PgDn Home End Esc Alt-P');
  210.   pg:=0;
  211.   endit:=false;
  212.   if osmajor >= 3 then
  213.     with regs do
  214.       begin
  215.       AX:=$3800;
  216.       DS:=seg(country);
  217.       DX:=ofs(country);
  218.       MSDOS(regs);
  219.       ccode:=BX;
  220.       decimal:=Chr(country[9]);
  221.       end;
  222.   end; {init}
  223. end.
  224.